<!DOCTYPE html>
{% load staticfiles %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'libs/bootstrap/css/bootstrap.css' %}">
    <style>
        input{display: block}
    </style>
</head>
<body>
<button id="but1">反选</button>
<form action="/question/delete_question/" method="post">
{% csrf_token %}
{% for a in res %}
 <div class="checkbox">
  <label>
    <input type="checkbox" name="q_id" class="input" value="{{ a.id }}">{{ a.id }} {{ a.question }}
  </label>
</div>
{% endfor %}
<button type="submit" id="submit">
    删除
</button>
</form>
  <script src="{% static 'libs/jquery/jquery.js' %}"></script>
  <script src="{% static 'libs/bootstrap/js/bootstrap.js' %}"></script>
<script>
    var b=$('.input');
$('#but1').click(function () {
    for (var a = 0; a < b.length; a++) {
        if (b[a].checked == true) {
            b[a].checked = false;
        } else {
            b[a].checked = true;
        }
    }
});
$('#submit').click(function (e) {
    res=confirm('确认删除这几项？');
    if(res!=true){
        e.preventDefault()
    }

})

</script>
</body>
</html>